package com.huluobo.a2107jetpackkotlindemo.databinding

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.huluobo.a2107jetpackkotlindemo.R

class UserActivity : AppCompatActivity() {
    private lateinit var activityUserBinding: ActivityUserBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        activityUserBinding = ActivityUserBinding.inflate(layoutInflater)
        setContentView(activityUserBinding.root)

        val user = DataBindingUser()//new 出一个user的对象
        activityUserBinding.user = user
//        activityUserBinding.userConfirm.setOnClickListener {
//            val user =
//                User(
//                    activityUserBinding.edUsername.text.toString(),
//                    activityUserBinding.edUserId.text.toString(),
//                    "https://pic3.zhimg.com/v2-20ec1b6c885a660ff3c68238fce5d55b_r.jpg?source=1940ef5c%EF%BF%BC"
//                )
//            val user = DataBindingUser()

//            activityUserBinding.tvUsername.text = user.username
//            activityUserBinding.tvUserId.text = user.userId
            //通过DataBinding实现咋activity中传递user对象给xml布局
//            activityUserBinding.user = user
//        }
    }
}